package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.AccountModel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;

/**
 * Created by sxy on 2016/7/12
 */
@Component("accountJpaRepository")
public interface AccountJpaRepository extends JpaRepository<AccountModel, Integer>, JpaSpecificationExecutor<AccountModel> {
 /*   *//**
     * 根据用户名获取账号信息
     * @param accountName
     * @return
     *//*
    @Query("select a from AccountModel a where a.accountName=?1")
    AccountModel getAccountInfo(String accountName);

    *//**
     * 修改密码
     * @param accountName
     * @param pwd
     * @return
     *//*
    @Modifying
    @Query("UPDATE AccountModel SET accountPwd=?2 WHERE accountName=?1")
    int updatePassword(String accountName, String pwd);

    @Query("select a from AccountModel a, 用户Model b where a.accountId = b.accountId and b.用户名 = ?1 ")
    AccountModel getAccountByUserName(String userName);*/

//    @Query("select a from AccountModel a, 用户Model b where a.accountId = b.accountId and a.accountName = ?1 and b.许可 = ?2")
//    AccountModel getAccountByUserNameAndPermit(String userName, String permit);

//    @Query("select a from AccountModel a,用户Model b where a.accountId = b.accountId and b.用户名 = ?1 and b.许可 = ?2")
//    AccountModel getAccountByUserAndPermit(String userName, String permit);
}

